<?php
	//get Rate of money
	$sql_rate="SELECT money FROM  tbl_currency ";
	$result_rate=mysql_query($sql_rate);
	$row_rate=mysql_fetch_assoc($result_rate);
	$rate_money=$row_rate['money'];
?>
<table class="bordered" width="770">
                    <thead>
                        <tr>
                            <th colspan="3">View Sales information <div class="new_sale"><a href="index.php?page=sale_list&action=sales">New Sales</a></div></th>
                        </tr>
                    </thead>
    <tr>
         <?php 
			if(@$errors!=""){
				echo " <td colspan=\"3\"><span class='red'>". @$errors."</span></td>";
			}else{
				if(isset($_REQUEST['msgStatus']))
					echo " <td colspan=\"3\"><span class='red'>". $_REQUEST['msgStatus'].@$_REQUEST['one']."</span></td>";
			 }
			?>
                           
    </tr>
</table>
<div id="dt_example">
    <table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
        <thead>
           <tr>
        	<th width="100">User</th>
            <th width="100">Sale ID</th>
            <th width="100">Customer</th>
			<th width="100">Date</th>
            <th width="100">Product</th>
            <th width="100">Amount</th>
            <th width="100">Paid</th>
			<th width="100">Balance</th>
            <!--<th width="100">Balance</th>-->
            <th width="100">Detail</th> 
      </tr>
        </thead>
        <tbody>
        <?php
			$sql="SELECT DISTINCT sale_id,pd_name ,cus_name,user_name,sale_date,amount,paid,balance FROM  tbl_sales ";	
			$result=query($sql);
			while($row = fetch_object($result))
			{
        ?>   
        <tr>
        	<td width="100"><?php echo $row->user_name; ?></td>
            <td width="100"><?php echo $row->sale_id; ?></td>
            <td width="100"><?php echo $row->cus_name; ?></td>
            <td width="100"><?php echo $row->sale_date; ?></td>
            <td width="100"><?php echo $row->pd_name; ?></td> 
            <td width="100"><?php echo $row->amount; ?></td>
            <td width="100"><?php echo $row->paid; ?></td>
            <td width="100"><?php echo $row->balance; ?></td>
            <!--<td width="100"><?php //echo $row->balance; ?></td>-->
            <td width="100"> 
                <a  href="index.php?page=sale_list&action=sale_list_detail&sale_id_detail=<?php echo $row->sale_id;?>"><img src="images/detail.png" width="26" height="26" border="0" title="Detail"></a>
            </td>
 		</tr>   
        <?php 
            }
        ?>
        </tbody>
    </table>
</div>